// 云函数入口文件
const cloud = require('wx-server-sdk')
const getMyJoin = require('./getMyJoin')
const getMyWin = require('./getMyWin')

// 初始化 cloud
cloud.init({
  // API 调用都保持和云函数当前所在环境一致
  env: cloud.DYNAMIC_CURRENT_ENV
})

const db = cloud.database()

// 云函数入口函数
exports.main = async (event, context) => {
  const wxContext = cloud.getWXContext()


  var methodName = event.methodName

  switch(methodName){
   
      case 'getMyJoin':

        return await getMyJoin({
          openid: event.openid,
          pageNum: event.pageNum,
          pageSize: event.pageSize
        })
        break
      case 'getMyWin':
         return await getMyWin({
          openid: event.openid,
          pageNum: event.pageNum,
          pageSize: event.pageSize
         })
          break
  }

  return {
   
  }
}